package com.haiyangwang1.lesson11;

public class Demo3 {
    public static int method3(int num){
        int sum=0;
        while (num>0) {
            sum += num % 10;
            num = num / 10;
        }
        return sum;
    }

    public static void main(String[] args) {
        Demo3 demo3=new Demo3();
        System.out.println(demo3.method3(5));
    }
}
